#!/usr/bin/perl -w
use strict;
use Bio::AlignIO;
use Bio::SimpleAlign;
use Getopt::Long;
use Bio::LocatableSeq;
my $informat = 'fasta';
my $outformat ='nexus';

my %seqs;
for my $file ( @ARGV ) {
    my $in = Bio::AlignIO->new(-format => $informat,
			       -file   => $file);
    if( my $aln = $in->next_aln ) {
	for my $seq( $aln->each_seq ) {
	    $seqs{$seq->id} .= $seq->seq;
	}
    }
}
my $compaln = Bio::SimpleAlign->new;
for my $id ( keys %seqs ) {
    $compaln->add_seq(Bio::LocatableSeq->new(-id => $id,
					     -start => 1,
					     -seq => $seqs{$id}));
}
my $out = Bio::AlignIO->new(-format => $outformat,
			    -show_symbols => 1,
			    -show_endblock => 1);
$out->write_aln($compaln);
